﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Telerik.WinControls.UI;
using TimeTracker.Provider;
using Utility;
using System.Windows.Forms;


namespace TimeTracker
{
    public partial class TreeViewLog
    {
        protected void Sort()
        {
            TreeView tree = this.treeView1;

            if (this.IsGroupByProject) {
                if (this.IsOrderAscending)
                {
                    tree.TreeViewNodeSorter = new Comparers.ProjectComparer();
                } else {
                    tree.TreeViewNodeSorter = new Comparers.ProjectComparerDescending();
                }
            }
            else if (!this.IsGroupByProject)
            {
                if (this.IsOrderAscending)
                {
                    tree.TreeViewNodeSorter = new Comparers.DateTimeComparer();
                } else {
                    tree.TreeViewNodeSorter = new Comparers.DateTimeComparerDescending();
                }
            }

            tree.Sort();
        }
    }
}
